"""
A class to exercise the JT core functions.
"""

import vtk
import JT


class Testing:

    def __init__(self):
        """
        """

    def TestingData(self):
        """
        Some sample data for testing purposes
        """
        #fixedFileName = 'C:/Lib/JointTrack/branches/bryan/Images/MovingImage.png'

        fixedFileName = 'C:/Users/bryan/bryan-code/2D3D/vert1/fluoro/ushortim080-LAT.mha'
        volFileName = 'C:/Users/bryan/bryan-code/2D3D/vert1/CT/ucharCTv1r1.mha'
        calFile = 'C:/Users/bryan/bryan-code/trunk/Tests/good_cal.txt'

        drr=JT.DRR()
        drr.SetCalibration(calFile)
        drr.SetVolumeFilename(volFileName)
        drr.SetVolumePosition((260,0,0))
        drr.Render()

        #self.SetWindowNames()

        #metric = itk.MeanSquaresImageToImageMetric.IF2IF2.New()
        #self.SetImageMetric(metric)

        #self.InitializeRegistration()
        #self.movingImageInteractor.Disable()


    def RotateVolume(self,poseTemp,steps):
        """
        poseTemp is a template to define what axes to rotate the volume about.
        poseTemp should be a numpy array
        eg. poseTemp = array(0,0,0,1,0,0) or (0,0,0,1,1,0)
        steps should be a rang, eg. steps = range(0,360,4)

        """
        for i in steps:
            pose = i * poseTemp
            self.SetPose(pose)
            self.movingImageRenWin.Render()



def Cone(resolution=10):
    """
    """

    cone = vtk.vtkConeSource()
    cone.SetHeight( 3.0 )
    cone.SetRadius( 1.0 )
    cone.SetResolution( resolution )

    coneMapper = vtk.vtkPolyDataMapper()
    coneMapper.SetInputConnection( cone.GetOutputPort() )

    coneActor = vtk.vtkActor()
    coneActor.SetMapper( coneMapper )

    return coneActor

def CreateWindow(actor):
    ren1= vtk.vtkRenderer()
    ren1.AddActor( actor )
    ren1.SetBackground( 0.1, 0.2, 0.4 )
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer( ren1 )
    renWin.SetSize( 300, 300 )
    renWin.Render()
    return renWin


if __name__ == "__main__":
    test = Testing()
    test.TestingData()